/*****************************************************************************************************************************
 * \file: Sensor.h    
 * \module: Sensor
 * \brief: Sensor module achive   
 * \project: 
 * \author:  SHB
 *============================================================================================================================
 *                                                   Revision control History
 *============================================================================================================================
 * V1.0.0: 2021-06-22: Initial Version
 *
 *
 *
 ****************************************************************************************************************************/
#ifndef SENSOR_H 
#define SENSOR_H

/*****************************************************************************************************************************
 * Other header files
 ****************************************************************************************************************************/
#include "Queue.h"
/*****************************************************************************************************************************
 * Macro decalaration
 ****************************************************************************************************************************/

/*****************************************************************************************************************************
 * Enum decalaration
 ****************************************************************************************************************************/

/*****************************************************************************************************************************
 * union decalaration
 ****************************************************************************************************************************/


/*****************************************************************************************************************************
 * typedef compound type decalaration
 ****************************************************************************************************************************/
typedef Queue_DataType Sensor_DataType;
typedef struct Sensor Sensor;

/*****************************************************************************************************************************
 * Struct decalaration
 ****************************************************************************************************************************/
struct Sensor {//传感器数据
    Queue super;
    Sensor_DataType PhysicVal;
    uint32_t SensorSampleChannel;
	Sensor_DataType (*Sensor_GetSampleRawPtr)(Sensor *me);
    void (*Sensor_CalcPtr)(Sensor *me);
};

/*****************************************************************************************************************************
 * Global variable decalaration
 ****************************************************************************************************************************/


/*****************************************************************************************************************************
 * Global function declaration prototype 
 ****************************************************************************************************************************/
/*!
 * \brief Sensor class Constructor
 * \param[in] Sensor pointer
 * \param[in] defaultVal sensor sample channel default value
 * \param[in] ChannelId Sample channel Initial
 * \param[in] fifoSize fifo Size
 * \return none
 */
extern void Sensor_Ctor(Sensor *me, Sensor_DataType defaultVal, uint32_t ChannelId, uint8_t fifoSize);
/*!
 * \brief Update Sample data, push sample data into its fifo, and caculate average value.
 * \param[in] me Sensor pointer
 * \return none
 */
extern void Sensor_Update(Sensor *me);

#endif
/*****************************************************************************************************************************
 * End of file
 ****************************************************************************************************************************/

